import axios from "axios";
import { Toast } from 'vant';


const http = axios.create({
    baseURL:'/api',
    timeout:3000
})

// 请求拦截
http.interceptors.request.use(config => {
    Toast.loading({
        message: '加载中...',
        forbidClick: true,
      });
      return config
},err => {
    throw new Error(err)
})

// 相应拦截
http.interceptors.response.use(res => {
    Toast.clear()
    return res.data
},err => {
    throw new Error(err)
})

export default http